﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace SLVSMMediaPlayer
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            // Required to initialize variables
            // re factor using code rush
            InitializeComponent();
            Loaded += MainPage_Loaded;
        }

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            VisualStateManager.GoToState(this, "MouseLeave", true);
            LayoutRoot.MouseEnter += LayoutRoot_MouseEnter;
            LayoutRoot.MouseLeave += LayoutRoot_MouseLeave;
            Playbtn.Click += Playbtn_Click;
            Stopbtn.Click += Stopbtn_Click;
            Pausebtn.Click += Pausebtn_Click;
            Playbtn.Cursor = Cursors.Hand;
            Stopbtn.Cursor = Cursors.Hand;
            Pausebtn.Cursor = Cursors.Hand;

        }

        void Pausebtn_Click(object sender, RoutedEventArgs e)
        {
            MyME.Pause();
            MyME1.Pause();
        }

        void Stopbtn_Click(object sender, RoutedEventArgs e)
        {
            MyME.Stop();
            MyME.Stop();
            MyME.Visibility = Visibility.Collapsed;
            MyME1.Visibility = Visibility.Collapsed;
        }

        void Playbtn_Click(object sender, RoutedEventArgs e)
        {
            MyME.Play();
            MyME1.Play();
            MyME.Visibility = Visibility.Visible;
            MyME1.Visibility = Visibility.Visible;

        }

        void LayoutRoot_MouseLeave(object sender, MouseEventArgs e)
        {
            VisualStateManager.GoToState(this, "MouseLeave", true);
        }

        void LayoutRoot_MouseEnter(object sender, MouseEventArgs e)
        {
            VisualStateManager.GoToState(this, "MouseEnter", true);
        }
    }
}